package com.tiger.db.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

public class BaseService<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> implements IService<T> {
    public List<T> pagination(QueryWrapper<T> wrapper, int pageNo, int pageSize) {
        int offset = (pageNo - 1) * pageSize;
        wrapper.last("limit " + offset + "," + pageSize);


        return list(wrapper);
    }

    public List<T> pagination(LambdaQueryWrapper<T> wrapper, int pageNo, int pageSize) {
        int offset = (pageNo - 1) * pageSize;
        wrapper.last("limit " + offset + "," + pageSize);


        return list(wrapper);
    }


}

